package com.itown.expo.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;

import webframe.common.helper.ControllerHelper;

import com.itown.expo.controller.base.MyBaseCommandController;
import com.itown.expo.model.GoodsClearItem;

public class CiqGoodsClearController extends MyBaseCommandController {

	@Override
	protected ModelAndView handleInner(HttpServletRequest request,
			HttpServletResponse response, Object command)
			throws RuntimeException {
		GoodsClearItem item = (GoodsClearItem) command;
		Long declId = ControllerHelper.extractId(request, "declId");
		Long goodsId = ControllerHelper.extractId(request, "goodsId");
		if (item.getClearFlag().intValue() == 3
				|| item.getClearFlag().intValue() == 5) {
			// ClearFlag 退回3 批准5
			getServiceContainer().getCheckBizService().updateCiqGoodsClear(
					declId, goodsId, item);
		}

		return new ModelAndView(new RedirectView("AuditClearList.html?id="
				+ declId));
	}

}
